#define SYS_STACK_SIZE 1024

typedef struct context{
	unsigned int BP, DI, SI, DS, ES;
	unsigned int DX, CX, BX, AX;
	unsigned int IP, CS, FLAGS;
} context;

typedef struct Params{
	int op_code;
	int device_id;
	unsigned char *buf_addr;
	int *count_addr;
} params;

void interrupt sys_call(void);

void interrupt dispatch(void);

void load_procs(char extra[]);

//R6 I/O Structures below

typedef struct iod{
	char pcb_name[10]; //name of pcb making request
	struct pcb *requester; //pcb making the IO request
	int request_type; //what kind of IO request - refers to R3 Op code
	char *trans_buffer; //location of transfer buffer - refers to R3 buffer_address
	int *buffer_count; //pointer to count variable of buffer - refers to R3 count_address
	struct iod *next; //next IOD in waiting queue
} iod;

typedef struct iocb{
	int event_flag; //holds device's event flag
	int count; //number of IODs in queue
	iod *head; //head of waiting queue
	iod *tail; //tail of waiting queue
} iocb;

void init_iocbs(void);

void io_scheduler(void);

void process_request_now(int);

void mpx_io_cleanup(void);

struct pcb *get_to_run(void);
void kill_to_run(void);